<!DOCTYPE html>
<html id="ng-app" ng-app="app" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>home</title>
</head>
<script>
</script>
<body>
<form class="form-signin" action="/login" method="post">
    <h2 class="form-signin-heading">用户登录</h2>
    <table>
        <tr>
            <td>用户名:</td>
            <td><input type="text" name="username" value="admin" class="form-control" placeholder="请输入用户名"/></td>
        </tr>
        <tr>
            <td>密码:</td>
            <td><input type="password" name="password" value="admin" class="form-control" placeholder="请输入密码"/></td>
        </tr>
        <tr>
            <td>验证码:</td>
            <td><input type="text" name="code" class="form-control" placeholder="请输入验证码"/></td>
            <td><img src="/rest/open/verifyCode"></td>
        </tr>
        <tr>
            <td colspan="2">
                <button type="submit" class="btn btn-lg btn-primary btn-block">登录</button>
            </td>
        </tr>
    </table>
</form>
    <br/> <br/> <br/> <br/> <br/>
<form class="form-signin" action="/login" method="post">
    <table>
        <tr>
            <td>邮箱:</td>
            <td><input type="text" id="email" name="username" value="1356111212@qq.com" class="form-control"
                       placeholder="请输入邮箱"/></td>
        </tr>
        <tr>
            <td>验证码:</td>
            <td><input name="sms" class="form-control" placeholder="请输入验证码"/></td>
        </tr>
        <tr>
            <td colspan="2">
                <button type="submit" class="btn btn-lg btn-primary btn-block">登录</button>
            </td>
        </tr>
    </table>
</form>
<button onclick="send()">发送验证码</button>
</body>
<script>
    function send() {
        var email = document.getElementById("email").value;
        var xmlHttp = new XMLHttpRequest();
        xmlHttp.open("GET", "/rest/open/sendEmail?email=" + email, true);
        xmlHttp.send(null);
        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                alert("发送成功");
            }
        }

    }
</script>
</html>